$(function() {

	// handle the page change event
	$(document).on("pagechange", function() {

		// only try and add the map on the map page
		if ($("#mapPage").length > 0) {

			tomtom.setImagePath("./img/map");

			var map = new tomtom.Map({
				domNode: "map",
				apiKey: "bpsquju23qaf4jzuewsnfdye",
				center: [52.01094, 4.35468],
				zoom: 14
			});

			var markerPhoenix = new tomtom.Marker([52.01094, 4.35468]);
			var markerTerrein = new tomtom.Marker([52.00424, 4.35453]);
			markerPhoenix.bindPopup("<b>Soci&euml;teit D.S.S. Phoenix</b><br>Phoenixstraat 30<br>2611 AL Delft");
			markerTerrein.bindPopup("<b>Lustrum Terrein</b><br>Van Bleyswijckstraat 72<br>2601 DE Delft");
			map.addLayer(markerPhoenix);
			map.addLayer(markerTerrein);

		}

	});

});